package cn.edu.flink.tutorial.state;

import org.apache.flink.api.common.restartstrategy.RestartStrategies;
import org.apache.flink.api.common.time.Time;
import org.apache.flink.runtime.state.filesystem.FsStateBackend;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class Backend {
    public static void main(String[] args) {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        String checkpointDataUri = "file:///Users/wangkang185/flink/checkpoint";
        env.setStateBackend(new FsStateBackend(checkpointDataUri));
        env.enableCheckpointing(1000);
        // 配置重启策略
        env.setRestartStrategy(RestartStrategies.fixedDelayRestart(60, Time.seconds(10)));
    }
}
